home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / makedosentry.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  88 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: makedosentry.c,v 1.3 1996/08/13 13:52:49 digulla Exp $
  4.     $Log: makedosentry.c,v $
  5.     Revision 1.3  1996/08/13 13:52:49  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.2  1996/08/01 17:40:54  digulla
  10.     Added standard header for all files
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <exec/memory.h>
  16. #include <clib/exec_protos.h>
  17. #include "dos_intern.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <clib/dos_protos.h>
  23.  
  24.     __AROS_LH2(struct DosList *, MakeDosEntry,
  25.  
  26. /*  SYNOPSIS */
  27.     __AROS_LHA(STRPTR, name, D1),
  28.     __AROS_LHA(LONG,   type, D2),
  29.  
  30. /*  LOCATION */
  31.     struct DosLibrary *, DOSBase, 116, Dos)
  32.  
  33. /*  FUNCTION
  34.     Create an entry for the dos list. Depending on the type this may
  35.     be a device a volume or an assign node.
  36.  
  37.     INPUTS
  38.     name - pointer to name
  39.     type - type of list entry to create
  40.  
  41.     RESULT
  42.  
  43.     NOTES
  44.  
  45.     EXAMPLE
  46.  
  47.     BUGS
  48.  
  49.     SEE ALSO
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.     29-10-95    digulla automatically created from
  55.                 dos_lib.fd and clib/dos_protos.h
  56.  
  57. *****************************************************************************/
  58. {
  59.     __AROS_FUNC_INIT
  60.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  61.  
  62.     STRPTR s2, s3;
  63.     struct DosList *dl;
  64.  
  65.     dl=(struct DosList *)AllocMem(sizeof(struct DosList),MEMF_PUBLIC|MEMF_CLEAR);
  66.     if(dl!=NULL)
  67.     {
  68.     s2=name;
  69.     while(*s2++)
  70.         ;
  71.     s3=(STRPTR)AllocMem(s2-name+1,MEMF_PUBLIC);
  72.     if(s3!=NULL)
  73.     {
  74.         /* Compatibility */
  75.         dl->dol_OldName=MKBADDR(s3);
  76.         *s3++=s2-name>256?255:s2-name-1;
  77.  
  78.         CopyMem(name,s3,s2-name);
  79.         dl->dol_Name=s3;
  80.         dl->dol_Type=type;
  81.         return dl;
  82.     }
  83.     FreeMem(dl,sizeof(struct DosList));
  84.     }
  85.     return NULL;
  86.     __AROS_FUNC_EXIT
  87. } /* MakeDosEntry */
  88.